<?
include("./_common.php");
include("$g4[path]/_head.php");

$shop = get_shop();
$goods_dir = $g4[path]."/data/goods/";
$CART = explode("/",$_SESSION["g4_cart"]);

?>
<link rel="stylesheet" href="<?=$g4['path']?>/shop/style.css" type="text/css">
<script language="javascript" src="<?=$g4['path']?>/shop/shop.js"></script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td>
		<table cellpadding="0" cellspacing="1" border="0" width="100%" style="border:solid 1px #CCCCCC">
			<tr align="center" height="20">
				<td bgcolor="#EFEFEF">상품명</td>
				<td bgcolor="#EFEFEF" width="100">옵션</td>
				<td bgcolor="#EFEFEF" width="80">수량</td>
				<td bgcolor="#EFEFEF" width="80">단가</td>
				<td bgcolor="#EFEFEF" width="80">합계금액</td>
				<td bgcolor="#EFEFEF" width="80">삭제</td>
			</tr>
		</table>
		<?
		if(trim($_SESSION["g4_cart"]))
		{
			$tot_price = 0;
			$tot_tranc = $shop[tranc_price];
			$lineCnt = 0;
			for($i=0;$i<count($CART);$i++)
			{
				$tmpField = explode("|",$CART[$i]);
				$tmpGcode = explode("OP",$tmpField[0]);
				$goods = get_goods($tmpGcode[0]);
				$g_option = get_option($goods[g_option],$tmpGcode[1]);
		?>
		<DIV style="width:100%;height:50px;float:left;padding:5 0 5 0;border-bottom:solid 1px #D7D7D7">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="50" style="table-layout:fixed">
			<tr>
				<td width="50" rowspan="2"><img src="<?=$goods_dir.$goods[g_img1]?>" width="50" height="50"></td>
				<td width="10" rowspan="2"></td>
				<td>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td><a href="<?=$goods[href]?>"><b><?=$goods[g_name]?></b></a><br><span style="color:orange"><?=$goods[g_info]?></span></td>
							<td width="100" align="center"><?=$g_option[0]?></td>
							<td width="80" align="center">
							<?=$tmpField[1]?>EA<br>
							<a href="javascript:Cart('add','<?=$goods[g_code]?>','','<?=$tmpGcode[1]?>');">┼</a>&nbsp;&nbsp;<a href="javascript:Cart('sub','<?=$goods[g_code]?>','','<?=$tmpGcode[1]?>');">─</a>
							</td>
							<td width="80" align="center"><span style="color:#990000"><?=number_format($goods[g_price]+$g_option[1])?>원</span></td>
							<td width="80" align="center"><span style="color:#990000"><b><?=number_format(($goods[g_price]+$g_option[1]) * $tmpField[1])?>원</b></span></td>
							<td width="80" align="center"><a href="javascript:Cart('del','<?=$goods[g_code]?>','0','<?=$tmpGcode[1]?>');">삭제</a></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td><span class="subinfo1">제조/판매원&nbsp;:&nbsp;<?=$goods[g_create]?></span>&nbsp;|&nbsp;<span class="subinfo2">원산지&nbsp;:&nbsp;<?=$goods[g_nation]?></span>&nbsp;|&nbsp;<span class="subinfo3">배송료&nbsp;:&nbsp;<?=$goods[tranc]?></span></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</DIV>
		<?
				$tot_price+= ($goods[g_price] + $g_option[1]) * $tmpField[1];
				if($tot_price >= $shop[tranc_if] || $goods[g_tranc] == "N" || $goods[g_tranc] == "C")
				{
					$tot_tranc = 0;
				}
				$lineCnt++;
			}
		}

		if($lineCnt==0)
		{
			echo("<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100'><tr align='center'><td>장바구니에 상품이 없습니다.</td></tr></table>");
		}
		?>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#EFEFEF">
				<tr align="right" height="30">
					<td>배송비 : <?=number_format($tot_tranc)?>원</td>
					<td>총구매금액 : <?=number_format($tot_price)?>원</td>
				</tr>
				<tr align="right" height="30">
					<td colspan="2"><span style="color:#990000;font-size:16px;font-weight:bold">총금액 : <?=number_format($tot_tranc + $tot_price)?>원</span></td>
				</tr>
			</table>
		<tr>
	</tr>
	<tr>
		<td align="center" height="50">
		<button class="cart_btn1" onclick="location.href='./goods_list.php';">쇼핑계속</button>&nbsp;
		<?if($tot_price){?><button class="cart_btn1" onclick="location.href='order_step1.php';">주문하기</button><?}?>
		</td>
	</tr>
</table>
<?
include("$g4[path]/_tail.php");

?>